package com.wd.visitor.common.service;

import com.wd.visitor.common.domain.dto.request.ApiRequest;
import com.wd.visitor.common.domain.dto.request.HeartBeatRequest;
import com.wd.visitor.common.domain.dto.request.ImageListRequest;
import com.wd.visitor.common.utils.HttpUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import static com.wd.visitor.common.constants.ApiConstant.HEART_BEAT_API;
import static com.wd.visitor.common.constants.ApiConstant.USER_LOGIN;

/**
 * @className: HearBeatService
 * @description: TODO 类描述
 * @author: liumingkun
 * @date: 2024/11/4
 **/

@Service
public class HearBeatService {

    private final static Logger logger = LoggerFactory.getLogger(HearBeatService.class);

    @Resource
    TokenService tokenService;

    public void heartBeat() {
        ApiRequest<HeartBeatRequest> requestParam = new ApiRequest<>();

        String token = tokenService.getToken();
        requestParam.getBasic().setToken(token);

        HeartBeatRequest heartBeatRequest = new HeartBeatRequest();
        heartBeatRequest.setAllow_renewal(true);

        requestParam.setData(heartBeatRequest);

        String result = HttpUtils.post(HEART_BEAT_API, requestParam.toString());

        logger.info("HeartBeat Result:" + result);

    }
}
